import 'package:flutter/material.dart';

import '../common/widget/reminder/index.dart';

class ToastUtil {
  static show(String msg,
      {Duration duration = Toast.LENGTH_SHORT, ToastThemeData themeData}) {
    toast(msg, duration: duration, themeData: themeData);
  }

  static void info(String content,
      {Duration duration = Toast.LENGTH_SHORT, ToastThemeData themeData}) {
    show(content,
        duration: duration,
        themeData: themeData ??
            ToastThemeData.raw(
                textColor: Colors.white,
                background: Colors.black54,
                alignment: Alignment.center));
  }

  static void warning(String content,
      {Duration duration = Toast.LENGTH_SHORT, ToastThemeData themeData}) {
    show(content,
        duration: duration,
        themeData: themeData ??
            ToastThemeData.raw(
                textColor: Colors.black,
                background: Colors.yellowAccent,
                alignment: Alignment.center));
  }

  static void success(String content,
      {Duration duration = Toast.LENGTH_SHORT, ToastThemeData themeData}) {
    show(content,
        duration: duration,
        themeData: themeData ??
            ToastThemeData.raw(
                textColor: Colors.white,
                background: Colors.blue,
                alignment: Alignment.center));
  }

  static void error(String content,
      {Duration duration = Toast.LENGTH_SHORT, ToastThemeData themeData}) {
    show(content,
        duration: duration,
        themeData: themeData ??
            ToastThemeData.raw(
                textColor: Colors.white,
                background: Colors.red,
                alignment: Alignment.center));
  }
}
